LAGOS Analysis

Loading in data

First download and then specifically grab the locus (or site lat longs)

# #Lagos download script
LAGOSNE::lagosne_get(dest_folder = LAGOSNE:::lagos_path())
## Warning in LAGOSNE::lagosne_get(dest_folder = LAGOSNE:::lagos_path()): LAGOSNE data for this version already exists on the local machine.
##   Re-download if neccessary using the 'overwrite` argument.'
#Load in lagos
lagos <- lagosne_load()
## Warning in (function (version = NULL, fpath = NA) : LAGOSNE version unspecified,
## loading version: 1.087.3
#Grab the lake centroid info
lake_centers <- lagos$locus

Convert to spatial data

#Look at the column names
#names(lake_centers)

#Look at the structure
#str(lake_centers)

#View the full dataset
#View(lake_centers %>% slice(1:100))

spatial_lakes <- st_as_sf(lake_centers,coords=c('nhd_long','nhd_lat'),
                          crs=4326) %>%
  st_transform(2163)

#Subset for plotting
subset_spatial <- spatial_lakes %>%
  slice(1:100) 

subset_baser <- spatial_lakes[1:100,]

#Dynamic mapviewer
mapview(subset_spatial)

Subset to only Minnesota

states <- us_states()

#Plot all the states to check if they loaded
#mapview(states)
minnesota <- states %>%
  filter(name == 'Minnesota') %>%
  st_transform(2163)

#Subset lakes based on spatial position
minnesota_lakes <- spatial_lakes[minnesota,]

#Plotting the first 1000 lakes
minnesota_lakes %>%
  arrange(-lake_area_ha) %>%
    slice(1:1000) %>%
  mapview(.,zcol = 'lake_area_ha')

In-Class work

1) Show a map outline of Iowa and Illinois (similar to Minnesota map upstream)

#Subeset to states of interest
new_states <- states %>%
  filter(name %in% c('Iowa', 'Illinois')) %>%
  st_transform(2163)

#Create map
mapview(new_states)

2) Subset LAGOS data to these sites, how many sites are in Illinois and Iowa

combined? How does this compare to Minnesota?

There are almost twice as many lakes in MN (29,038 lakes) as in IA and IL combined (16,466 lakes).

3) What is the distribution of lake size in Iowa vs. Minnesota?

  • Here I want to see a histogram plot with lake size on x-axis and frequency on y axis (check out geom_histogram)
#Get IA outline
iowa <- states %>%
  filter(name == 'Iowa') %>%
  st_transform(2163)

#Prep state data
ia_lakes <- spatial_lakes[iowa,] %>%
  mutate(state = 'IA')

mn_lakes <- minnesota_lakes %>%
  mutate(state = 'MN')

#Plot it!
ia_lakes %>%
  rbind(mn_lakes) %>%
  tibble() %>%
  ggplot(.,aes(x = lake_area_ha, color = state))+
    scale_x_log10()+
    geom_histogram()+
    labs(x = 'Lake Area (ha)', y = 'Count')+
    facet_wrap(~state)

The shape of the distribution is similar between IA and MN (which makes sense as they were both formed by the same glacial processes), but MN has many more lakes in each bin.

4) Make an interactive plot of lakes in Iowa and Illinois and color them

by lake area in hectares

#Map lakes using previous code
new_lakes %>%
  arrange(-lake_area_ha) %>%
    slice(1:1000) %>%
  mapview(.,zcol = 'lake_area_ha')

5) What other data sources might we use to understand how reservoirs and

natural lakes vary in size in these three states?

You could use remotely sensed data to find larger lakes and the USGS’s NHD database to find smaller ponds.